home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
501_600
/
DISK0510
/
DISK0510.ZIP
/
FILEDEMO
< prev
next >
Wrap
Text File
|
1985-08-08
|
896b
|
27 lines
PROGRAM FILEDEMO; {a demonstration of reading from the terminal,}
{writing to a disk file, then reading the disk file to the screen.}
VAR
DISKFILE:TEXT;
S1:STRING;
BEGIN
WRITELN('filedemo demonstration program');
ASSIGN(DISKFILE,'file1'); {DISKFILE will have name 'file1'}
REWRITE(DISKFILE); {set it up for writing}
REPEAT
WRITE('line:'); {prompt for user input}
READLN(S1); {press F6 CR to enter an EOF}
WRITELN(DISKFILE,S1); {write to disk file}
UNTIL EOF(INPUT);
WRITELN;
RESET(DISKFILE); {now set up to read the disk file}
WHILE NOT EOF(DISKFILE) DO
BEGIN
READLN(DISKFILE,S1);
WRITELN(S1); {and copy it to the screen}
END;
WRITELN("that's all!");
END.